#include <stdio.h>
#include <iostream>
#include <vector>

using namespace std;

class Solution {
private:
    void backtrack(vector<vector<int>> &answers, vector<int> &answer, int start, int end, int k) {
        if (answer.size() == k) {
            answers.push_back(answer);
            return;
        }

        for (int i = start; i <= end; i++) {
            answer.push_back(i);
            backtrack(answers, answer, i+1, end, k);
            answer.pop_back();
        }
    }
public:
    vector<vector<int>> combine(int n, int k) {
        vector<vector<int>> answers;
        vector<int> answer;
        backtrack(answers, answer, 1, n, k);
        return answers;
    }
};

int main(void)
{

    cout << "#77. 组合" << endl;
    vector<vector<int>> anss = Solution().combine(3, 3);
    cout << anss.size() << endl;
    for (auto e: anss) {
        for (auto it: e)
            cout << it << ", ";
        cout << endl;
    }
    return 0;
}